<template>
  <div class="AddFiling">
    <!-- <template v-if="!isSumit"> -->
      <div class="stepList">
        <div class="stepItem" v-for="(item ,i) in arrowList" :key="i" :class="reportState.step >= i?'stepActive':''">{{item}}</div>
      </div>
      <div style="margin-top: 40px;">

        <div class="content">
          <div class="arrow">{{arrowList[reportState.step]}}</div>
          <router-view></router-view>
        </div>
      </div>
      <div class="isStepBox">
        <p class="prevStep" @click="onStepPrev">上一步</p>
        <p class="nextStep" v-if="!reportState.isLastStep" @click="onStepNext">下一步</p>
        <p class="nextStep" v-else @click="onStepNext">确认提交</p>
      </div>
    <!-- </template> -->
    <!-- <template v-else>
      <div class="succBox">
        <p class="succTip">提交报备成功</p>
        <p class="succTip">您可在 "我的报备" 中查看报备记录及状态</p>
        <p class="timeOut">
          <span>{{seconds}}</span>秒后自动关闭
        </p>
      </div>
    </template> -->
  </div>
</template>

<script>
// import step1 from './addFiling/FilingType.vue'
// import step2 from './addFiling/FilingInfo.vue'
// import step3 from './addFiling/FilingProduct.vue'
// import step4 from './addFiling/ConfirmSubmit.vue'
import { nextTick } from '@vue/composition-api'
import { useReport } from '@/hooks/report'

export default {
  name: 'AddFiling',
  setup () {
    const { reportState, onStepNext, onStepPrev, gotoReport, reportReset } = useReport()
    console.error('123')
    // nextTick(() => {
    //   reportReset()
    //   gotoReport()
    // })

    return {
      reportState,
      onStepNext,
      onStepPrev,
      arrowList: ['报备方式', '报备基础信息', '报备商品信息', '确认提交'],
    }
  },
}
</script>

<style lang="scss" scoped>
.AddFiling {
  width: 1300px;
  margin: 0 auto;
  .stepFourColor {
    color: #f00;
    text-align: center;
    margin-top: 20px;
  }
}
.stepList {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  .stepItem {
    line-height: 50px;
    font-size: 16px;
    color: #fff;
    width: 280px;
    // flex: 1;
    text-align: center;
    position: relative;
    // padding-left: 10px;
    &::before {
      content: ' ';
      position: absolute;
      z-index: -1;
      left: 0;
      width: 300px;
      height: 50px;
      background-color: #ccc;
      -webkit-clip-path: polygon(
        0 0,
        240px 0,
        265px 25px,
        240px 50px,
        0 50px,
        25px 25px
      );
      clip-path: polygon(0 0, 260px 0, 285px 25px, 260px 50px, 0 50px, 25px 25px);
    }
    &:first-child::before {
      -webkit-clip-path: polygon(0 0, 260px 0, 285px 25px, 260px 50px, 0 50px);
      clip-path: polygon(0 0, 260px 0, 285px 25px, 260px 50px, 0 50px);
    }
    &:last-child::before {
      -webkit-clip-path: polygon(0 0, 285px 0, 285px 50px, 0 50px, 25px 25px);
      clip-path: polygon(0 0, 285px 0, 285px 50px, 0 50px, 25px 25px);
    }
  }
  .stepActive::before {
    background: $--color-primary;
  }
}
.content {
  margin-top: 10px;
  border: 1px solid #999;
  position: relative;
  padding: 50px 20px;
  min-height: 300px;
  .arrow {
    width: 130px;
    height: 40px;
    line-height: 40px;
    -webkit-clip-path: polygon(0 0, 110px 0, 130px 20px, 110px 40px, 0 40px);
    clip-path: polygon(0 0, 110px 0, 130px 20px, 110px 40px, 0 40px);
    background-color: $--color-primary;
    font-size: 14px;
    color: #fff;
    text-align: center;
    position: absolute;
    left: -70px;
    top: 30px;
    padding-right: 12px;
  }
}
.isStepBox {
  width: 720px;
  display: flex;
  align-self: center;
  justify-content: space-between;
  margin: 0 auto;
  margin-top: 40px;
  .nextStep,
  .prevStep {
    width: 130px;
    height: 35px;
    line-height: 35px;
    color: #ffffff;
    background: $--color-primary;
    border: 1px solid $--color-primary;
    text-align: center;
    cursor: pointer;
  }
  .prevStep {
    color: $--color-primary;
    background: #fff;
  }
}
.contentGt {
  padding: 25px 0 0;
}
.succBox {
  margin: 120px 0;
  .succTip {
    font-size: 16px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 10px;
  }
  .timeOut {
    text-align: center;
    font-size: 14px;
    padding-top: 10px;
    span {
      color: #e51c23;
    }
  }
}
</style>
